package Views::Helpers::JS;
use warnings;

sub new {
	return bless {name=>'javascript', dir=> 'js/', files=> undef, script =>undef}, shift;
}

sub addFiles {	
	my $self=shift; 
	foreach (@_) {
		$$self{files} .= "<script src=\"$self->{dir}$_\" type=\"text/javascript\"></script>";
	}
}

sub setScript {
	my $self=shift; 
	my $script = shift;
	$$self{script} = "<script type=\"text/javascript\"> $script </script>";
}

sub getScript {
	my $self=shift; 
	return $self->{script};
}

sub getName {
	my $self = shift;
	return $self->{name};
}

sub getFiles { 
	my $self = shift;
	return $self->{files};
}
 
1;